import {Directive} from '@angular/core';
import {Calendar} from 'primeng/calendar';

@Directive({
  selector: '[gnCalendar]',
})
export class CalendarDirective {

  static locale_chs = {
    today: '今天',
    clear: '清除',
    firstDayOfWeek: 0,
    dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
    dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
    dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
    monthNames: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
    monthNamesShort: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
  };

  constructor(private calendar: Calendar) {
    calendar.hourFormat = '24';
    calendar.showSeconds = true;
    calendar.dateFormat = 'yy-mm-dd';
    calendar.locale = CalendarDirective.locale_chs;
    // calendar.dataType = 'string';

    calendar.calendarElement = this;
  }

}
